﻿using B.S.BaseData.Domain;
using B.S.BaseData.Domain.Base;
using B.S.BaseData.Domain.Implements;
using B.S.BaseData.Domain.Interfaces;
using B.S.BaseData.Domain.RBAC;
using B.S.BaseData.Infrastructure.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace B.S.BaseData.Infrastructure.Implements
{
	public class GetDepartUserCount: BaseRepository<Department>, IGetDepartUserCount
	{
		private readonly BaseDataDbContext db;

		public GetDepartUserCount(BaseDataDbContext db):base(db)
		{
			this.db = db;
		}

		public async Task<int> DepartUserCount(int departId)
		{
			try
			{
				var usercount = db.UserInfo.Where(a => a.DepartmentId == departId).Count();
				return usercount;
			}
			catch (Exception)
			{

				throw;
			}
		}

	}
}
